package general.art;

import general.exceptions.NodeNotFoundException;
import general.semantics.WeightSearch;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import art.applications.seek.Result;


/**
 * 
 * Cluster with a center node as the seed node.
 * 
 * @author thomas
 *
 */
public class WeightedCenteredCluster  extends CenteredCluster{

	private final Map<Node, Double> weightMap = new HashMap<Node, Double>();

	
	public WeightedCenteredCluster(int seedNodeId, int depth) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException, NodeNotFoundException {
		
		super(seedNodeId, depth);
		WeightSearch myWeightSearch = new WeightSearch();
		myWeightSearch.preformQuery(this);
		
		while (myWeightSearch.hasNext())
    	{
    	
    		Result<NodeTypes> r = myWeightSearch.nextResult();
    		weightMap.put((Node) r.node(), r.weight());
    		
    	}
		
		
		
	}
	
	public double getWeight(Node n){
		
		return weightMap.get(n);
		
	}
	
	
	
}
